import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:niu_app/configs/app_style_config.dart';
import 'package:niu_app/pages/model/homepage/delegation_records_model.dart';
import 'package:niu_app/views/jk/jk_text.dart';


class delegationrecordswidget extends StatelessWidget {
  final delegationmodel dataModel;

  const delegationrecordswidget({Key key, this.dataModel}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          bottom(),
          Divider(color: AppStyleConfig.color7,),
        ],
      ),
    );
  }
  Widget bottom(){
    return Padding(
      padding: EdgeInsets.fromLTRB(16, 18, 16, 8),
      child:  Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  JKText(
                    data: "${dataModel.time}",
                    fontSize: 12.w,
                    weight: FontWeight.bold,
                  ),
                  SizedBox(width: 5,),
                  JKText(
                    data: "${dataModel.time1}",
                    fontSize: 12.w,
                    weight: FontWeight.bold,
                  )
                ],
              ),
              Row(
                children: [
                  color1(dataModel.color1),
                  SizedBox(width: 5.w,),
                  color2(dataModel.color2)
                ],
              )
            ],
          ),
          SizedBox(height: 10,),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  JKText(
                    data: "数量：",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  ),
                  JKText(
                    data: "${dataModel.number}",
                    fontSize: 12.w,
                    weight: FontWeight.bold,
                  )
                ],
              ),
              Row(
                children: [
                  JKText(
                    data: "价格：",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  ),
                  JKText(
                    data: "${dataModel.price}",
                    fontSize: 12.w,
                    weight: FontWeight.bold,
                  )
                ],
              ),
            ],
          ),
          SizedBox(height: 10,),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              Column(
                children: [
                  JKText(
                    data: "${dataModel.number1+"/"+dataModel.number2}",
                    fontSize: 14.w,
                    weight: FontWeight.bold,
                  ),
                  JKText(
                    data: "跟单",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  )
                ],
              ),
              Column(
                children: [
                  JKText(
                    data: "${dataModel.number3}",
                    fontSize: 14.w,
                    weight: FontWeight.bold,
                  ),
                  JKText(
                    data: "委托",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  )
                ],
              ),
              Column(
                children: [
                  JKText(
                    data: "${dataModel.number4}",
                    fontSize: 14.w,
                    weight: FontWeight.bold,
                  ),
                  JKText(
                    data: "撤销",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  )
                ],
              ),
              Column(
                children: [
                  JKText(
                    data: "${dataModel.number5}",
                    fontSize: 14.w,
                    weight: FontWeight.bold,
                  ),
                  JKText(
                    data: "成交",
                    color: AppStyleConfig.color2,
                    fontSize: 12.w,
                  )
                ],
              ),
            ],
          ),
        ],
      ),
    );
  }
  Widget color1(Color color){
    return Container(
      height: 18.w,
      width: 32.w,
      decoration: BoxDecoration(
          border: Border.all(color: color)
      ),
      child: Center(
          child: JKText(data: "${dataModel.title1}",fontSize: 12.sp,color: color,)
      ),
    );
  }
  Widget color2(Color color){
    return Container(
      height: 18.w,
      width: 32.w,
      decoration: BoxDecoration(
          border: Border.all(color: color)
      ),
      child: Center(
          child:JKText(data: "${dataModel.title2}",fontSize: 12.sp,color: color,)
      ),
    );
  }
}
